package com.example.personnel_oa.controller;

import com.example.comment_oa.pojos.Offer;
import com.example.comment_oa.response.AjaxResponse;
import com.example.personnel_oa.service.OfferService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("personnelOa")
public class OfferController {
    @Autowired
    OfferService offerService;

    //新增offer数据
    @PostMapping("offer/add")
    public AjaxResponse addOffer(@RequestBody Offer offer){
        int i = offerService.addOffer(offer);
        return AjaxResponse.success(i);
    }
    //查询是否有offer数据
    @PostMapping("offer/cxoffer/{talentsId}")
    public AjaxResponse cahx(@PathVariable("talentsId") int talentsId){
        Offer offer = offerService.chaOffer(talentsId);
        return AjaxResponse.success(offer);
    }
    //发送offer
    @PostMapping("offer/upOffer")
    public AjaxResponse upOffer(@RequestBody Offer offer){
        int i = offerService.upOffer(offer);
        return AjaxResponse.success(i);
    }

}
